<template>
  <div>
    <div>
      姓 ： <input type="text" v-model="firstname">
    </div>
    <div>
      名 ： <input type="text" v-model="lastname">
    </div>
    <div>
      姓名 ：<input type="text" v-model="fullname">
    </div>
  </div>
</template>
  ​
<script>
export default {
  data() {
    return {
      firstname: "张",
      lastname: "三",
    }
  },
  computed: {
      fullname:{
          get(){
              return this.firstname+'-'+this.lastname
          },
          set(value){
            let [a,b] =  value.split('-');
            this.firstname = a;
            this.lastname = b;
          }
          
      }
    
  }
}
</script>